home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / ArchiveUtils / JumpBack / Source / make_dir.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1995-06-12  |  621 b   |  49 lines

  1. #!/bin/sh
  2. #
  3. # make the directory of sym links
  4. # echo only if there is a problem
  5. #
  6. #    param 1    = src directory
  7. #    param 2 = dest directory
  8.  
  9. if  [ "$1x" = "x" ]
  10. then
  11.     echo missing src directory
  12.     exit 0
  13. fi
  14.  
  15. if  [ "$2x" = "x" ]
  16. then
  17.     echo missing dest directory
  18.     exit 0
  19. fi
  20.  
  21.  
  22. CD_DIR_NAME=`basename $1`
  23. LINK_DIR_NAME=$2/$CD_DIR_NAME
  24.  
  25.  
  26. if [ ! -d $LINK_DIR_NAME ];
  27. then
  28.     mkdir $LINK_DIR_NAME
  29. fi
  30.  
  31. if [ ! -d $LINK_DIR_NAME ];
  32. then    
  33.     exit 0
  34. fi
  35.  
  36. if [ -d $LINK_DIR_NAME ];
  37. then
  38.     cd $LINK_DIR_NAME
  39.     for i in $1/*
  40.     do
  41. #        if there is no sym link, then make one
  42.         if [ ! -h $LINK_DIR_NAME/`basename $i` ]
  43.         then
  44.             ln -s $i .
  45.         fi
  46.     done
  47. fi
  48.  
  49.